package tests;

import java.util.Random;

import models.Hangman3;
import tools.DateHeader;
import tools.SeedRNGCommandLine;

/**
 * 
 * @author J Paul Gibson<br>
 * 
 * Random play of hangman game to illustrate functionality<br>
 * Expected typical output:<br>
 <pre>
 The seed used for the random number generator in the test is 0.
You can override this value by passing an integer value as a main argument parameter, if you so wish.


********************************************************************
Execution Date/Time 2011/11/07 17:50:57
********************************************************************

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: yellow
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: yellow
Letters Found: ??????
Letters Tried: --cd---h-j---n-pqr---v-x--

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: red
Letters Found: ???
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: red
Letters Found: ???
Letters Tried: -bc---g-----mn----st-vw-y-

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: indigo
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: indigo
Letters Found: ??d?g?
Letters Tried: ---d--g--jk----p-rst-v-xyz

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: orange
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: orange
Letters Found: o?ange
Letters Tried: abc-efg--j-l-nopq-s-u-w---

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: green
Letters Found: ?????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: green
Letters Found: ?r???
Letters Tried: a--d-f-h-j--m-op-r--u---y-

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: indigo
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: indigo
Letters Found: ?n??g?
Letters Tried: -b--e-gh-j-lmn----s---wx-z

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: orange
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: orange
Letters Found: o??n??
Letters Tried: -b-d----ijk--no----t-vwx-z

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: red
Letters Found: ???
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: red
Letters Found: r?d
Letters Tried: -bcd------k-m-opqrs-----yz

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: green
Letters Found: ?????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: green
Letters Found: gr??n
Letters Tried: ab---fg----lmnopqr-t---x--

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: orange
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: orange
Letters Found: ?ra???
Letters Tried: a-c--f---jkl---pqrs--v-x--

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: blue
Letters Found: ????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: blue
Letters Found: ?l??
Letters Tried: --cd-fgh---l-nop-r----w---

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: orange
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: orange
Letters Found: ??a???
Letters Tried: a-c----h--klm---q-s---wxy-

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: yellow
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: yellow
Letters Found: yell?w
Letters Tried: a-cde-g---klm-----st--wxyz

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: red
Letters Found: ???
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: red
Letters Found: re?
Letters Tried: ----e--h--klm-op-rs-uv-x--

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: violet
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: violet
Letters Found: vio?e?
Letters Tried: ab-de-ghij----opq---uv---z

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: orange
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: orange
Letters Found: ?r??g?
Letters Tried: --c---ghij------qrs-u--xyz

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: indigo
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: indigo
Letters Found: i??ig?
Letters Tried: ab--e-g-ij------qr--u-wx-z

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: violet
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 10 from 10
Current Word: violet
Letters Found: v?ole?
Letters Tried: --cdefg----l--opqr--uv-xy-

*******Starting A New Game********

Hangman3 -- Errors: 0 from 10
Current Word: indigo
Letters Found: ??????
Letters Tried: --------------------------

Hangman3 -- Errors: 5 from 10
Current Word: indigo
Letters Found: indigo
Letters Tried: a--d--g-i----no---s--v-x-z

*******Congratulations - you have finally won ********
 </pre>
 *
 */
public class Hangman3RandomTest {

		
		public static void main(String[] args) {
			
				Random rng = SeedRNGCommandLine.getRandom(args);
				System.out.println(DateHeader.dateString());
				
				String [] colours = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"};
				
				Hangman3 hangman3 = new Hangman3(rng,colours);
				
				while (!hangman3.foundWord()){
					
				System.out.println("\n*******Starting A New Game********");
				hangman3.randomWord();
				System.out.println(hangman3);        
		        while (!hangman3.gameOver()){
		        hangman3.tryLetter((char) ('a' + rng.nextInt(26)));
		        } 
		        System.out.println(hangman3);
		       	}
				
				System.out.println("\n*******Congratulations - you have finally won ********");
		        
			}
}
